package com.groupfour.attendancemanagementsystem.exception;

import com.groupfour.attendancemanagementsystem.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author xin
 * @date 2022/4/12 15:43
 * 处理异常
 */
@RestControllerAdvice
@Slf4j
public class UnifiedExceptionHandler {

    @ExceptionHandler(value = Exception.class )
    public Result handlerException(Exception e){
        log.info("服务器内部异常。{}",e.getMessage());
        return Result.fail(e.getMessage());
    }
}
